from fastapi import Depends, FastAPI
from sqlmodel import SQLModel
from typing import Annotated
from contextlib import contextmanager,asynccontextmanager

from basic_backtest.routers.data_loader import data_loader_router
from basic_backtest.models.stock_data_models import *

from database.database import engine

@asynccontextmanager
async def lifespan(app:FastAPI):
    SQLModel.metadata.create_all(bind=engine)
    yield


app = FastAPI(lifespan=lifespan)
app.include_router(data_loader_router)

@app.get("/")
async def hello_world():
    return "Hello World!" 
# class CommonQueryParams:
#     def __init__(self, q: str | None = None, skip: int = 0, limit: int = 100):
#         self.q = q
#         self.skip = skip
#         self.limit = limit


# @app.get("/items/")
# async def read_items(commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)]):
#     return response